{extend name="default/base/base_seller" /}
{block name="seller_btn"}
{if isset($isPlatformStore) || config('ds_config.promotion_wholesale_price')==0}
<a class="dssc-btn dssc-btn-green" href="{:url('Sellerpromotionwholesale/wholesale_add')}"><i class="iconfont">&#xe6db;</i>{$Think.lang.wholesale_add}</a>
{else /}
{notempty name="current_wholesale_quota"}
<a class="dssc-btn dssc-btn-green" style="right:100px" href="{:url('Sellerpromotionwholesale/wholesale_add')}"><i class="iconfont">&#xe6db;</i>{$Think.lang.wholesale_add}</a>
<a class="dssc-btn dssc-btn-acidblue" href="{:url('Sellerpromotionwholesale/wholesale_quota_add')}" title=""><i class="iconfont">&#xe6a1;</i>{$Think.lang.set_renewal}</a>
{else }
<a class="dssc-btn dssc-btn-acidblue" href="{:url('Sellerpromotionwholesale/wholesale_quota_add')}" title=""><i class="iconfont">&#xe6a1;</i>{$Think.lang.wholesale_quota_add}</a>
{/notempty}
{/if}


{/block}
{block name="seller_main"}
{if isset($isPlatformStore) || config('ds_config.promotion_wholesale_price')==0}
<div class="alert alert-block mt10">
    <ul>
        <li>{$Think.lang.information_discount_activities1}</li>
        <li>{$Think.lang.information_discount_activities2}</li>
    </ul>
</div>
{else }
<div class="alert alert-block mt10">
    {notempty name="current_wholesale_quota"}
    <strong>{$Think.lang.overdue_set_meal}{$Think.lang.ds_colon}</strong><strong style="color:#F00;">{$current_wholesale_quota.wholesalequota_endtime|date="Y-m-d H:i:s"}</strong>
    {else /}
    <strong>{$Think.lang.please_buy_set_meal}</strong>
    {/notempty}
    <ul>
        <li>{$Think.lang.wholesale_explain1}</li>
        <li>{$Think.lang.wholesale_explain2}</li>
        <li>{$Think.lang.wholesale_explain3}</li>
        <li>4、<strong style="color: red">{$Think.lang.deduction_settlement_payment_days}</strong>。</li>
    </ul>
</div>
{/if}

<form method="get">
    <table class="search-form">
        <tr>
            <td>&nbsp;</td>
            <th>{$Think.lang.ds_state}</th>
            <td class="w100"><select name="state">
                    {notempty name="wholesale_state_array"}
                    {foreach name="wholesale_state_array" item="val"}
                    <option value="{$key}" {if $key==$Request.get.state}selected{/if}>{$val}</option>
                    {/foreach}
                    {/notempty}
                </select></td>
            <th class="w110">{$Think.lang.wholesale_name}</th>
            <td class="w160"><input type="text" class="text w150" name="wholesale_name" value="{$Request.get.wholesale_name}"/></td>
            <td class="w70 tc"><input type="submit" class="submit" value="{$Think.lang.ds_search}"/></td>
        </tr>
    </table>
</form>
<table class="dssc-default-table">
    <thead>
        <tr>
            <th class="w100"></th>
            <th class="tl">{$Think.lang.wholesale_name}</th>
            <th class="w200">{$Think.lang.start_time}</th>
            <th class="w200">{$Think.lang.end_time}</th>
            <th class="w200">{$Think.lang.ds_state}</th>
            <th class="w200">{$Think.lang.ds_handle}</th>
        </tr>
    </thead>
    <tbody id="wholesale_list">
        {notempty name="wholesale_list"}
        {foreach name="wholesale_list" item="val"}
        <tr class="bd-line">
            <td></td>
            <td class="tc">
                <dl class="goods-name">
                    <dt>{$val.goods_name}</dt>
                </dl>
            </td>
            <td class="goods-time">{$val.wholesale_starttime|date="Y-m-d H:i"}</td>
            <td class="goods-time">{$val.wholesale_end_time|date="Y-m-d H:i"}</td>
            <td>{$val.wholesale_state_text}</td>
            <td class="dscs-table-handle tc">
                {if $val.editable}
                <span>
                    <a href="{:url('Sellerpromotionwholesale/wholesale_edit',['wholesale_id'=>$val.wholesale_id])}" class="btn-blue">
                        <i class="iconfont">&#xe731;</i>
                        <p>{$Think.lang.ds_edit}</p>
                    </a>
                </span>
                {/if}
                <span>
                    <a href="javascript:;" dstype="btn_del_wholesale" data-wholesale-id={$val.wholesale_id} class="btn-red">
                        <i class="iconfont">&#xe725;</i>
                        <p>{$Think.lang.ds_delete}</p>
                    </a>
                </span>
            </td>
        </tr>
        {/foreach}
        {else /}
        <tr id="wholesale_list_norecord">
            <td class="norecord" colspan="20">
                <div class="warning-option"><i class="iconfont">&#xe64c;</i><span>{$Think.lang.no_record}</span>
                </div>
            </td>
        </tr>
        {/notempty}
    </tbody>
    <tfoot>
        {notempty name="wholesale_list"}
        <tr>
            <td colspan="20">
                <div class="pagination">{$show_page|raw}</div>
            </td>
        </tr>
        {/notempty}
    </tfoot>
</table>
<form id="submit_form" action="" method="post">
    <input type="hidden" id="wholesale_id" name="wholesale_id" value="">
</form>

<script type="text/javascript">
    $(document).ready(function () {
        $('[dstype="btn_del_wholesale"]').on('click', function () {
            var action = "{:url('Sellerpromotionwholesale/wholesale_del')}";
            var wholesale_id = $(this).attr('data-wholesale-id');
            layer.confirm('{$Think.lang.ds_ensure_del}', {
                btn: ['{$Think.lang.ds_ok}', '{$Think.lang.ds_cancel}'],
                title: false,
            }, function () {
                $('#submit_form').attr('action', action);
                $('#wholesale_id').val(wholesale_id);
                ds_ajaxpost('submit_form', 'url', "{:url('Sellerpromotionwholesale/index')}")
            });
        });
    });
</script>

{/block}
